package com.study.lihan.reflect;

import com.study.lihan.bean.Wife;

import java.lang.reflect.Method;

/**
 * @Author: lihan
 * @Date : 2022/2/13- 02
 * @DESCRIPTION: com.study.lihan.reflect
 * @version: 1.0
 */
public class TestReflect {
    public static void main(String[] args) throws  Exception {
        Wife wife = new Wife();
        Class wifeClass = Wife.class;
        Method method = wifeClass.getMethod("setName", String.class);
        method.invoke(wife,"林允儿");
        System.out.println(wife);


    }
}
